Skip to content

fix(i18n, mcp): a translation fault serves untranslated text; ?locale= reaches MCP labels and dataset sentences - #35680

Merged
os-zhuang merged 4 commits into
mainfrom
claude/area-a4C-34993
Nov 20, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/area-a4C-34993

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #34993
Fixes #35083
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:翻译服务读取出错时,AI 问数(数据集列表、数据集查询)、对象工具和元数据接口改为返回未翻译的原文,不再清空目录或报错;其中只有数据集列表会直接告诉客户端「翻译出错」(partial + warning),数据集查询、对象工具和元数据接口只在服务器日志记一行(客户端提示另立 review follow-ups of PR #35680: client-visible translation-fault warning slot, three unguarded i18n bundle builders, two test gaps #35707);AI 客户端用网址参数指定语言时,标签和说明句统一为同一种语言。
  • 为什么做:属于「AI 问数」专题,解决中文租户的 AI 客户端在翻译故障时整批查询失败、以及同一回答中英混杂的问题。
  • 出错会怎样:最坏情况是界面或 AI 回答显示原文标签而非译文,数据本身不受影响;改动可直接撤回。
  • 要你做什么:无。

What changes

Commit 1 (translation fault). translationBundleOf (packages/rest/src/meta-item-read-gate.ts) now catches a throwing getLocales / getTranslations: it answers no bundle (text served untranslated, exactly as a deployment with no bundle), logs one warn line, and hands the same sentence to an optional MetaListTranslationSources.reportTranslationFault. Every caller gets it once: REST /meta list and by-name (was 500), the meta-types and form translations, both MCP object tool paths, and both dataset loaders. The two dataset loaders return { items, warning } (the existing DatasetToolSource object form, without partial); the executor carries that warning on list_datasets (with partial: true, the pair the spec declares) and does not fail query_dataset closed on it.

Commit 2 (?locale=). metaTranslationSources and the app-docs locale in packages/runtime/src/domains/mcp.ts read the request query as well as its headers (mcpRequestHttp: the host's parsed query, else the URL's). DatasetToolsDeps gains an optional translationLocale, the locale loadDatasets translated for; the executor reads labels and composes nextStep / sourceLine in it first. Both transports pass it.

Commit 3. Test-only: module-top @objectstack/objectql import in the new REST pin (check:test-source-alias).

Pins flipped in place (#34876, seat ruling A, now ruled B by #34993):

  • packages/mcp/src/stdio-data-bridge.dataset-locale.test.ts and packages/runtime/src/mcp-dataset-tools-bridge.test.ts: list_datasets on a throwing i18n read was datasets: [] + partial + "could not be read" warning; now the dataset in its authored label + partial: true + the i18n error in warning. query_dataset was 503 SERVICE_UNAVAILABLE; now it answers (rowCount 1, authored provenance label).

New pins: REST /meta list and by-name answer 200 untranslated and log the fault (packages/rest/src/meta-translation-fault-34993.test.ts); the stdio object tools serve the authored labels on the fault; ?locale=zh-CN with no Accept-Language answers labels, nextStep and sourceLine equal to an Accept-Language: zh-CN caller's (HTTP); a header-less stdio call answers nextStep / sourceLine equal to a zh-CN principal's when the labels are zh-CN.

Read first (by risk): translationBundleOf in meta-item-read-gate.ts (the catch that every /meta caller now goes through); answerLocales in dataset-tools.ts (the translation locale outranks the caller's own locale for sentences); mcpRequestHttp in runtime/src/domains/mcp.ts.

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/mcp-dataset-tools-bridge.test.ts — expect 12 passed, including the ?locale= case.

Verification

Head 1ac62a18 (package suites ran on 2c712f55; 1ac62a18 adds one test-file import, its file re-run green).

Package tests and typecheck
  • pnpm --filter @objectstack/service-analytics test: Test Files 219 passed, Tests 5609 passed / 345 skipped
  • pnpm --filter @objectstack/mcp test: Test Files 79 passed, Tests 1442 passed
  • pnpm --filter @objectstack/rest test: Test Files 422 passed, Tests 8628 passed / 351 skipped
  • pnpm --filter @objectstack/runtime test: Test Files 631 passed, Tests 11629 passed / 25 skipped
  • typecheck for the same four (tsc plus check:test-typecheck): lock VERDICT command-exit 0
Ablations (one-shot, restored, blob == HEAD after each)
  • Guard removed (throw error in the catch of translationBundleOf): REST pin 2 failed (status 500), stdio file 6 failed, runtime file 4 failed.
  • metaTranslationSources back to headers only: runtime ?locale= case red ('Sales analysis' vs '销售分析').
  • Executor ignoring translationLocale: stdio header-less case red (nextStep differs).
Derived gates

node scripts/pm/dispatch-gates.mjs --commands: 74 families, all run; --ran reconciliation 74/74. 71 exit 0. check:test-source-alias red on the first run, fixed in commit 3, re-run exit 0. NOT MEASURED: check:dual-build-cjs-loads (exit 3, PREREQUISITE NOT MET: no full pnpm build in this worktree) and check-plugin-teardown-shape --self-test (exit 3, shallow clone cannot reach its pinned fixture); both are left to CI. overlap-check: clean.

Acceptance notes

  • No client-visible warning channel on two surfaces. REST /meta and the MCP object tools (list_objects, describe_object) have no envelope key for a warning on a whole answer, and the tool layer (mcp-http-tools.ts) is outside this claim's file surface; so they serve untranslated text and the warning goes to the server log only. query_dataset's warning is declared "present exactly when delegationNarrowed", so it carries no translation warning either. No envelope key was invented. Named follow-up (boundary flag): review follow-ups of PR #35680: client-visible translation-fault warning slot, three unguarded i18n bundle builders, two test gaps #35707 (review follow-ups of this PR, filed before merge so closing i18n: a translation fault (getLocales/getTranslations throws) blanks list_datasets and refuses query_dataset (503) instead of serving untranslated text — the same on object tools and REST /meta #34993 rests on a recorded scope cut): a client-visible whole-answer warning slot for REST /meta, the MCP object tools and query_dataset changes the contract shape, so it is out of this PR; list_datasets already carries the warning.
  • list_datasets says partial: true on a translation fault. The spec pairs warning with partial; the catalogue is whole but its label matching may miss, which is what partial warns the model about.
  • Sentence locale on stdio follows the labels. A stdio principal with its own locale now gets sentences in the i18n default when the labels are in it (the labels never followed the principal's locale on stdio).
  • translationBundleOf is also reached by the /meta types and form translations in rest-server.ts; they now degrade the same way rather than throwing.
  • Commits carry no card trailer; the PR body declares the cards.

🤖 Generated with Claude Code

…arning

An i18n service that resolves but whose getLocales/getTranslations throws
is now a translation fault, answered at the shared translator
(translationBundleOf) as no bundle: the text is served untranslated, the
server log says so at warn, and an optional reportTranslationFault hands
the same sentence to a door that carries a warning on its answer.

REST /meta list and by-name reads answer 200 untranslated (was 500); the
MCP object tools serve the authored labels; list_datasets keeps its
datasets, partial with the fault's warning (was datasets: []); and
query_dataset answers (was 503), on both MCP transports. The pins that
held the degraded answer are flipped in place.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
…es share one locale

metaTranslationSources (and the app-docs locale) read the request's query
as well as its headers, the way the /meta doors do. The dataset executor
takes an optional translationLocale dependency, the locale loadDatasets
translated for, and resolves labels, nextStep and sourceLine in it first;
both MCP transports pass it. Pinned: ?locale=zh-CN with no Accept-Language
answers what an Accept-Language: zh-CN caller is answered, and a
header-less stdio call answers labels and sentences in one language.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
…ult pin

The REST /meta translation-fault pin reaches a lazy objectql import through
RestServer; a module-top side-effect import pays it during collection
(check:test-source-alias).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/mcp, @objectstack/rest, @objectstack/runtime, @objectstack/service-analytics, touching 15 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/permissions/authorization.mdx (via buildMcpBridge (symbol, a top-level function))
What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 52 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 238661f47f3937c0cd79cebade410141763775ec → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 50a7e64bd9d2429d76535282975ffa517ec4ded2 — the merge of head ee348e46da2f09d614cf403fc0ea60a11c79d0dc into base 238661f47f3937c0cd79cebade410141763775ec, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 50a7e64bd9d2429d76535282975ffa517ec4ded2 && git checkout 50a7e64bd9d2429d76535282975ffa517ec4ded2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 238661f47f3937c0cd79cebade410141763775ec ee348e46da2f09d614cf403fc0ea60a11c79d0dc && git checkout -B drift-repro 238661f47f3937c0cd79cebade410141763775ec && git merge --no-ff ee348e46da2f09d614cf403fc0ea60a11c79d0dc

node scripts/docs-audit/affected-docs.mjs --json 238661f47f3937c0cd79cebade410141763775ec

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 238661f47f3937c0cd79cebade410141763775ec → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Final green head: 1ac62a18ec24aabd9acf290767996b5c1324699c (Fixes #34993 + #35083). CI green on this head, no conflict with main. Area a4-C asks L1-a for the L1 review on this head; no further pushes planned unless the review asks.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1H9ixhgepGZ7fawhL

L1 verdict (L1-a): CHANGES at head 1ac62a18ec24aabd9acf290767996b5c1324699c (announced in 7026876682). The code is sound. The two must-fix items are the PR body and how the card is closed.

Gates on this head: 57 check-runs: 39 success, 18 skipped, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both passed.

Must-fix:

  1. PR body, 维护者速读 first bullet. It says untranslated text is returned 「并带提示」 on dataset list/query, the object tools and /meta. Only list_datasets carries a client-visible warning (partial: true + warning). REST /meta, list_objects/describe_object and query_dataset only write a server log line, as the body's own Acceptance notes say. The maintainer reads this bullet, so correct it to say which surfaces show the client a warning and which only log one.
  2. Fixes #34993 against the card's Change section. The card says "A translation fault serves untranslated text with a warning on all three surfaces together", and this PR delivers the client warning on list_datasets only. Pick one:

What I checked (holds):

  • No unrelated error is swallowed. The try/catch in meta-item-read-gate.ts (~3276-3295) wraps only getLocales/getTranslations, returns undefined, logs (logWarn) and calls the reportFault hook. Protocol reads and translateMetadataDocument are outside it.
  • Every claimed path is reached.
    • Both translators pass the hook (~3643, ~3719).
    • REST list, by-name and meta-types reach them through rest-server.ts.
    • Both dataset loaders return {items, warning} only when a fault was reported (runtime/src/domains/mcp.ts ~1766, mcp/src/stdio-data-bridge.ts ~1726).
    • query_dataset fails closed only on loaded.partial, which the object form never sets, so it answers.
  • ?locale= reaches labels and sentences. mcpRequestHttp feeds metaTranslationSources and the docs locale. The order is Accept-Language, then ?locale=, then the default, as the changeset says. translationLocale is passed on both transports and puts that locale first for labels, nextStep and sourceLine.
  • The mcp: a pin for the dataset tools when the i18n service resolves but its reads throw #34876 pins are flipped in place, with controls, at runtime, stdio (including the object tools) and REST. The ?locale= pins have a differing-language control. The ablations in the body fail on revert.
  • Changeset. One patch entry each for rest, runtime, mcp and service-analytics, all public. Clause-②: yes (widening) and Metadata-protocol: none are correct, and the changed files match the claims 7023293145 / 7023246861.

Notes (non-blocking):

  1. The changeset headline "serves the untranslated text with a warning" reads as a client warning. "and logs a warning" (plus "and flags list_datasets partial") would be exact.
  2. On a fault, translationLocale still names the requested locale, so nextStep/sourceLine come out in that language while the labels are authored text. "One language" holds only when translation succeeds.
  3. HTTP callers with no Accept-Language and no ?locale= now get sentences in the i18n default rather than the principal's own locale. The body states this for stdio only.
  4. plugin-auth invitation-role-label.ts (~86) no longer sees the fault, so it logs its "no label was found… check the bundles" warning beside rest's [meta] line. The output is unchanged.
  5. These copies of the bundle builder outside this claim are still unguarded and are follow-up candidates:
    • metadata-protocol/src/protocol-discovery-and-bases.ts (~1209)
    • service-analytics/src/plugin.ts (~1131)
    • service-storage/src/record-file-access.ts (~715)
  6. Test gaps:
    • no fault pin on the HTTP object-tools path;
    • the mcpRequestHttp branch that reads a host's already-parsed request.query is untested.

Next: fix the two body items (no code change needed, so the head need not move if only the body changes). I re-read and ACCEPT on the same head.


Generated by Claude Code

…arns the client

The untranslated text is served and the fault is logged; only
list_datasets carries a client-visible partial flag and warning, while
REST /meta, the MCP object tools and query_dataset log only.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4cxk4f4T7at3YeFruhZ

L1 verdict (L1-a): ACCEPT at head 1ac62a18ec24aabd9acf290767996b5c1324699c (same head as CHANGES 7026981486; only the body moved). L1-a successor thread; the code review in 7026981486 stands unchanged.

Both must-fix items are resolved in the body:

  1. 维护者速读 first bullet now says only the dataset list tells the client (partial + warning), while dataset query, the object tools and the metadata endpoint log on the server only, with the client warning moved to review follow-ups of PR #35680: client-visible translation-fault warning slot, three unguarded i18n bundle builders, two test gaps #35707. This matches the Acceptance notes and the code.
  2. Fixes #34993 now rests on a recorded scope cut. Follow-up review follow-ups of PR #35680: client-visible translation-fault warning slot, three unguarded i18n bundle builders, two test gaps #35707 (open, p3, area:ai, domain:server) was filed before merge. It carries the client-visible warning slot for REST /meta, list_objects/describe_object and query_dataset. It also carries the three unguarded bundle-builder copies (non-blocking note 5) and the two test gaps (note 6). The Acceptance notes name it.

Gates on this head: 61 check-runs: 41 success, 20 skipped, 0 failed, 0 pending. The PR-body guards and Check Changeset re-ran on the body edit and passed (01:01Z, 01:03Z).

Not governed (no skills/**, docs/adr/** or spec), so the area lands it.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4cxk4f4T7at3YeFruhZ

L1 verdict (L1-a): ACCEPT (delta) at head ee348e46da2f09d614cf403fc0ea60a11c79d0dc. This carries ACCEPT 7027099375 (at 1ac62a18) forward.

Delta 1ac62a18..ee348e46: one commit, one file, +1/-1. It changes only the headline of .changeset/34993-translation-fault-untranslated.md. The new headline names which surface warns the client: list_datasets is flagged partial with a warning, while REST /meta, the MCP object tools and query_dataset only log. This is exact against the code and resolves non-blocking note 1 of 7026981486. The bump lines, Clause-②: yes (widening) and Metadata-protocol: none are unchanged.

Gates on this head: 53 check-runs: 37 success, 16 skipped, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both passed.

Not governed, so the area lands it.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Final green head: ee348e46da2f09d614cf403fc0ea60a11c79d0dc (delta over ACCEPTed 1ac62a1: one commit, changeset headline wording only, +1/-1, L1 note 1). CI green, no conflict. Area a4-C asks L1-a for the delta read on this head.

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 44678141769 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (2/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/colleague-lookup-over-mcp.dogfood.test.ts > a member's agent finds a colleague through the read-only sys_user over MCP (ruling B) > ⭐ the query tool's
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected 'Query records from an object with opt…' to contain 'sys_user'
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 11 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@os-zhuang
os-zhuang deleted the claude/area-a4C-34993 branch November 20, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants